﻿using GoodDotNet.Data.Models;

namespace GoodDotNet.Core.Controller
{
    public class BaseController
    {
        /// <summary>
        /// 成功
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        protected Result Sucess(object message)
        {
            return new Result
            {
                errorCode = ErrorCode.Sucess,
                message = message
            };
        }
        /// <summary>
        /// 捕获错误
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        protected Result CatchError(object message)
        {
            return new Result
            {
                errorCode = ErrorCode.CatchError,
                message = message
            };
        }
        /// <summary>
        /// 签名错误
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        protected Result SignError(object message)
        {
            return new Result
            {
                errorCode = ErrorCode.SignError,
                message = message
            };
        }
        /// <summary>
        /// 没有登录
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        protected Result NoLogin(object message)
        {
            return new Result
            {
                errorCode = ErrorCode.NoLogin,
                message = message
            };
        }
        /// <summary>
        /// 没有查询到数据
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        protected Result NoData(object message)
        {
            return new Result
            {
                errorCode = ErrorCode.NoData,
                message = message
            };
        }
        protected Result NoPermission(object message)
        {
            return new Result
            {
                errorCode = ErrorCode.NoPermission,
                message = message
            };
        }

    }
}
